package com.bop.dehong.http.model;

import java.lang.reflect.Type;

import android.app.Activity;

import com.base.dehong.http.HttpRequest;
import com.base.dehong.http.RequestCallBack;
import com.base.dehong.util.MD5Util;
import com.base.dehong.util.StringUtils;
import com.bop.dehong.config.Config;
import com.bop.dehong.info.entity.RegistEntity;
import com.google.gson.reflect.TypeToken;

public class RegisterModel extends HttpRequest<RegistEntity>{
	
	public RegisterModel(Activity activity, RequestCallBack<RegistEntity> callback) {
		super(activity, callback);
		// TODO Auto-generated constructor stub
	}
	public void doNet(String name,String password,String invit_code,String phonecode, String device_code, String phone_type) {
		mPostValues.put("a", "addreg");
		mPostValues.put("cellphone", name);
		if (StringUtils.isNotEmpty(invit_code)) {
			mPostValues.put("invit_code", invit_code);
		}
		mPostValues.put("m", "Passport");
		mPostValues.put("password", MD5Util.getMD5String(password));//密码md5加密
		mPostValues.put("phonecode", phonecode);
		mPostValues.put("phone_type", phone_type);
		mPostValues.put("device_code", device_code);
		mPostValues.put("platform", "android");
		requestByPost();
	}

	@Override
	public String getURL() {
		// TODO Auto-generated method stub
		return Config.getIP() + Config.getRegisterUrl();
	}

	@Override
	public Type getType() {
		// TODO Auto-generated method stub
		return new TypeToken<RegistEntity>() {}.getType();
	}
	
	@Override
	public Class<RegistEntity> getClazz()
	{
		return RegistEntity.class;
	}
	

}
